home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / batime.zip / TIMEOUT.DOC < prev   
Text File  |  1993-04-21  |  4KB  |  98 lines

  1. TIMEOUT.COM  Released to public domain.
  2.  
  3. TIMEOUT.COM docs.
  4.  
  5. Timeout is a decision loop for use in DOS batch files.
  6. When started (the command takes no arguments or parameters), the
  7. program looks for a Y or y entry.  If found before the program
  8. times out, timeout returns an ERRORLEVEL exit code of 10.  If any
  9. other keystroke is detected or if the program times out, timeout
  10. returns an ERRORLEVEL exit code of 20.
  11.  
  12. ***************************************************************
  13.  
  14. A typical use of timeout.com would be in an autoexec.bat file
  15. as follows:
  16.  
  17. echo Don't launch Windows 3.1? (y/n)?
  18. timeout
  19. rem Timeout returns exit code 20 if Y/y pressed, exit code 10
  20. rem      for any other keypress or if it times out.
  21. if errorlevel 10 if not errorlevel 11 goto winit
  22. if errorlevel 20 if not errorlevel 21 goto stopit
  23. :winit
  24. win
  25. :stopit
  26.  
  27. **************************************************************
  28.  
  29. The timeout loop is set by a value in the first instruction of the
  30. program and can be changed using DEBUG, as follows (in the
  31. following example, capitalization does not matter; <ret> means hit
  32. the enter key; xxxx and nnnn are explained after the example):
  33.  
  34. DEBUG RESPONDS                 YOU TYPE
  35.                                debug timeout.com <ret>
  36. -                              a 0100 <ret>
  37. xxxx:0100                      mov cx,nnnn <ret>
  38. xxxx:0103                      <ret>
  39. -                              w <ret>
  40. -                              q <ret>
  41.  
  42. After the last <ret>, DEBUG will return you to the DOS prompt.  The
  43. value of xxxx is unimportant and may be ignored.  The value of nnnn
  44. is the timeout delay expressed in hexidecimal and is just an
  45. arbitrary number.  The larger the value of nnnn, the longer the
  46. wait before timeout.  The number does not correspond directly to
  47. seconds or anything because the speed with which the program
  48. executes is dependent on the speed of the machine it's run on. 
  49. With my 386SX 20, the default value of 4000 takes about 10 seconds 
  50. to timeout.
  51.  
  52. *************************************************************
  53.  
  54. F.Y.I., the assembly code for timeout.com follows:
  55.  
  56.                      ; timeout loop
  57. MOV     CX,1388      ; load loop value into cx for use by LOOP
  58. MOV     AH,0B        ; [103] use DOS to see if key pressed
  59. INT     21           ; do last step
  60. CMP     AL,FF        ; last step puts ff into al if key pressed
  61. JZ     011F          ; if true (0), jump out of loop
  62. LOOP     0103        ; loop, exits if cx down to 0
  63.  
  64.                      ; exit code 10 (timeout or non-y/Y)
  65. MOV     DL,0D        ; [010D] stick carriage return into dl
  66. MOV     AH,02        ; print that carriage return to screen
  67. INT     21
  68. MOV     DL,0A        ; repeat last 3 steps except with linefeed
  69. MOV     AH,02
  70. INT     21
  71. MOV     AL,0A        ; stick decimal 10 into al register
  72. MOV     AH,4C        ; exit and take al value as exit code
  73. INT     21
  74.  
  75.                      ; process keypress
  76. MOV     AH,01        ; [11F] get key that was pressed, put in al
  77. INT     21
  78. CMP     AL,00        ; if al is 00, then extended key was pressed
  79. JZ     010D          ; if al=00 go to exit code 10 exit
  80. CMP     AL,59        ; is al=Y?
  81. JZ     0131          ; if so go to exit code 20 exit
  82. CMP     AL,79        ; is al=y
  83. JZ     0131          ; if so go to exit code 20 exit
  84. JMP     010D         ; if not Y or y go to exit code 10 exit
  85.  
  86.                      ; exit code 20 exit (Y/y pressed)
  87. MOV     DL,0D        ; [0131] stick carriage return into dl
  88. MOV     AH,02        ; print that carriage return to screen
  89. INT     21
  90. MOV     DL,0A        ; repeat last 3 steps except with linefeed
  91. MOV     AH,02
  92. INT     21
  93. MOV     AL,14        ; stick decimal 20 into al register
  94. MOV     AH,4C        ; exit and take al value as exit code
  95. INT     21
  96.  
  97.  
  98.